-
Notifications
You must be signed in to change notification settings - Fork 599
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove custom arguments in object.__new__ of BaseInstrumentor #1439
Conversation
Nice, please add another test case, one that pretty much does this and checks no exception is raised: def test_some_test_case_name(self):
try:
SystemMetricsInstrumentor()
SystemMetricsInstrumentor(config={})
except Exception as error:
self.fail(f"Unexpected exception {error} raised")
# do any necessary resetting
try:
SystemMetricsInstrumentor()
SystemMetricsInstrumentor(config={})
except Exception as error:
self.fail(f"Unexpected exception {error} raised") |
I added an extra case as per @ocelotl request. I assumed he meant the init order should be inverted in the second case. 😉 |
right! 😅 some tests are failing, please take a look |
All failing tests I've checked were related to #1460. Now that it got merged, I think it should be alright. |
Both failing jobs failed due to some issue with
|
This should be fine now. |
@ocelotl PTAL |
@ocelotl @srikanthccv Linting failed due to a style change in |
@ocelotl PTAL |
Description
Classes inheriting from
BaseInstrumentor
class are singletons tracked by_instance
attribute and this piece of codeIf an instrumentor child class with parameters, e.g.
SystemMetricsInstrumentor
is initialized first, then these parameters are also passed toobject.__new__
which results in an error as in #1438.Given the answers in this SO question, I am inclined to think that it's not needed to pass arguments to
object.__new__
and they can be safely removed. Those arguments will still end up in the__init__
call.Fixes #1438
Type of change
Please delete options that are not relevant.
How Has This Been Tested?
Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration
tox
for multiple other instrumented packagesDoes This PR Require a Core Repo Change?
Checklist:
See contributing.md for styleguide, changelog guidelines, and more.